<!--
 * @Descripttion: 
 * @Version: 1.0
 * @Author: wcl
 * @Date: 2023-10-18 14:25:04
 * @LastEditors: wcl
 * @LastEditTime: 2023-10-18 15:26:50
-->
<template>
  <div class="flex">
    <div>
      <span>{{ userInfo.username }},欢迎你</span>
    </div>
    <div @click="logout">
      <span>退出</span>
    </div>
  </div>
</template>

<script setup>
import { useRouter } from "vue-router";
import { useUserStore } from "@/store/modules/user";
const router = useRouter();
const userStore = useUserStore();
const logout = () => {
  userStore.logout();
};
const userInfo = JSON.parse(sessionStorage.getItem("user")).userInfo;
console.log(userInfo);
const handelMsg = () => {
  const newBlank = router.resolve({ path: "/message" });
  window.open(newBlank.href, "_blank");
};
</script>

<style lang="less" scoped>
.flex {
  display: flex;
  align-items: center;
  color: #fff;
  > div {
    margin-left: 20px;
    cursor: pointer;
    color: #42495a;
    display: flex;
    align-items: center;
    .msg {
      color: #1990ff;
      margin-left: 10px;
    }
    img {
      width: 24px;
    }
  }
}
</style>
